<%@page import="org.jeecgframework.web.util.StaticValue" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@include file="/context/mytags.jsp" %>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<div class="easyui-layout" fit="true">
    <div region="center" style="padding:1px;">
        <t:datagrid name="zyEquipmentSpareList" fitColumns="false" title="设备信息"
                    actionUrl="zyEquipmentSpareController.do?datagridBj"
                    idField="id" fit="true" queryMode="group" autoLoadData="false" >
            <t:dgCol title="主键" field="id" hidden="true" queryMode="single" width="120"></t:dgCol>
            <t:dgCol title="* 备件类型" field="typeDescs" hidden="true" query="true" width="120"/>
            <t:dgCol title="* 备件序列号" field="item" hidden="true" query="true" queryMode="single" width="120"/>
            <t:dgCol title="设备SN" field="sn" width="120"/>
            <t:dgCol title="机型" field="type.typeDesc" queryMode="single" width="120"/>
            <t:dgCol title="BP" field="bpNo" queryMode="single" width="100"/>
            <t:dgCol title="省市" field="tsTerritoryVal" width="80" sortable="false"/>
            <t:dgCol title="省市" field="tsTerritory.territoryName" hidden="true" queryMode="single" sortable="false"
                     width="80"/>
            <t:dgCol title="所在影院名称" field="zyCinema.name" queryMode="single" width="200"/>
            <t:dgCol title="发货日期" field="sendDate" queryMode="single" width="90" formatter="yyyy-MM-dd"/>
            <t:dgCol title="安装日期" field="installDate" queryMode="group" width="90" formatter="yyyy-MM-dd"/>
            <t:dgCol title="保修期" field="baseRepairDate" queryMode="single" width="90" formatter="yyyy-MM-dd"/>
            <t:dgCol title="保修截止日期" field="repairEndDate" queryMode="group" width="90" formatter="yyyy-MM-dd"/>
            <t:dgCol title="是否异常" field="isNormal" queryMode="single" width="60"
                     dictionary="<%=StaticValue.DIC_TRUE_OR_FALSE_NUM %>"/>
            <t:dgCol title="设备服务状态" field="serverState" queryMode="single" width="100"
                     dictionary="<%=StaticValue.DIC_SERVER_STATE %>"/>
            <t:dgCol title="激光改造" field="laserReconstruction" queryMode="single" width="70"
                     dictionary="<%=StaticValue.DIC_TRUE_OR_FALSE_NUM %>"
                     defaultSelectVal="<%=StaticValue.DIC_TRUE_OR_FALSE_NUM_0 %>"/>
        </t:datagrid>
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function () {
        //给时间控件加上样式
        $("#zyEquipmentSpareListtb").find("input[name='installDate_begin']").attr({
            "class": "Wdate",
            "id": "installDate_begin"
        }).click(function () {
            WdatePicker({dateFmt: 'yyyy-MM-dd', maxDate: '#F{$dp.$D(\'installDate_end\')}'});
        });
        $("#zyEquipmentSpareListtb").find("input[name='installDate_end']").attr({
            "class": "Wdate",
            "id": "installDate_end"
        }).click(function () {
            WdatePicker({dateFmt: 'yyyy-MM-dd', minDate: '#F{$dp.$D(\'installDate_begin\')}'});
        });
        $("#zyEquipmentSpareListtb").find("input[name='repairEndDate_begin']").attr({
            "class": "Wdate",
            "id": "repairEndDate_begin"
        }).click(function () {
            WdatePicker({dateFmt: 'yyyy-MM-dd', maxDate: '#F{$dp.$D(\'repairEndDate_end\')}'});
        });
        $("#zyEquipmentSpareListtb").find("input[name='repairEndDate_end']").attr({
            "class": "Wdate",
            "id": "repairEndDate_end"
        }).click(function () {
            WdatePicker({dateFmt: 'yyyy-MM-dd', minDate: '#F{$dp.$D(\'repairEndDate_begin\')}'});
        });

        //将查询条件必填，加红*
        function repstr(repstr,obj){
            var str = '<span style="color:red">'+repstr+'</span>';
            $(obj).html($(obj).text().replace(repstr,str));
        }

        $("#zyEquipmentSpareListtb").find("span[title^='*']").each(function(i,item){
            repstr("*",this);
        });

        territoryLink("zyEquipmentSpareList", "tsTerritory.territoryName");
        chooseTypeDecForQueryParam("typeDec");
    });

    /**
     * 通用 绑定搜索条件 弹出式选择BP页
     */
    function chooseTypeDecForQueryParam() {
        $("#typeDescs").removeAttr("onkeypress onkeydown").focus(function () {
            $.dialog({
                content: 'url:cbsEquipmentApplyController.do?chooseEquipmentType',
                zIndex: 21000,
                title: '选择备件类型',
                lock: true,
                width: '300px',
                height: '600px',
                left: '85%',
                top: '65%',
                opacity: 0.4,
                init: function () {
                    top.myWindow = window;
                }
            });
        });
    }

</script>